package com.lifesea.rocketmq.utils.message;

import com.lifesea.rocketmq.utils.message.codec.JsonMessageEncoder;

/**
 * Created by iscdw on 2016/4/26.
 */
public class JsonMessage extends AbstractMessage<Object> {

    /**
     * Construct a message, call encoder method to encoder the data.
     *
     * @param topic topic can't be null.
     * @param tag   you can use tag to route the business logic, in rocketmq tag can be null, but it can't be null here
     * @param key   business order id or unique key, you can use this key to find the message in rocketmq console
     * @param data  the real data to send, any class can be encoded by message encoder
     */
    public JsonMessage(String topic, String tag, String key, Object data) {
        super(topic, tag, key, data);
    }

    @Override
    public MessageEncoder<Object> getMessageEncoder() {
        return JsonMessageEncoder.create();
    }

}
